package cn.cy.behavior.state.pattern;

/**
 * @author yangxq
 * @desc 电梯上下文
 * @Date 2025-05-07
 */
public class Elevator {

    // 上下文持有一个具体状态的引用
    private ElevatorState state;

    public Elevator() {
        // 初始状态为停止
        state = new StoppedState();
    }

    public void setState(ElevatorState state) {
        this.state = state;
    }

    public void up() {
        state.up(this);
    }

    public void down() {
        state.down(this);
    }

    public void stop() {
        state.stop(this);
    }

}
